Imports ComponentGo.Calendars

Imports Phoenix.Events
Imports Phoenix.Security

<Serializable()> Class PhoenixConfiguration

#Region " Aux "
    <NonSerialized()> Private mDelayConfig As Boolean = False
    <NonSerialized()> Private mShouldSerialize As Boolean = False

    Private Property DelayConfig() As Boolean
        Get
            Return mDelayConfig
        End Get
        Set(ByVal Value As Boolean)
            mDelayConfig = Value
        End Set
    End Property

    Private Property ShouldSerialize() As Boolean
        Get
            Return mShouldSerialize
        End Get
        Set(ByVal Value As Boolean)
            mShouldSerialize = Value
        End Set
    End Property

    Private Sub OnConfigurationChanged()
        If DelayConfig Then
            ShouldSerialize = True
        Else
            AppRaiseEvent(Me, New PhoenixEventArgs(Me, PhoenixEventCode.ConfigurationChanged))
        End If
    End Sub
#End Region

#Region " Serializable fields "
    Private mEnableAutoLogout As Boolean
    Private mAutoLogoutTime As Integer

    Private mFitToPage As Boolean

    Private mDayViewColumnNumber As Integer
    Private mDayViewResolution As HoursResolutions
    Private mResolution As HoursResolutions
    Private mScheduleResolution As HoursResolutions

    Private mNewAppBG As Color
    Private mOpenAppBG As Color
    Private mSchedAppBG As Color
    Private mPaidAppBG As Color
    Private mNewAppFG As Color
    Private mOpenAppFG As Color
    Private mSchedAppFG As Color
    Private mPaidAppFG As Color
    Private mSelectedAppBG As Color
    Private mSelectedAppFG As Color
    Private mFreeHourColor As Color
    Private mExtraFreeHourColor As Color
    Private mWorkHourColor As Color
    Private mWorkHourColor2 As Color
    Private mBreakBG As Color
    Private mBreakFG As Color
    Private mAdditionalTimeBG As Color
    Private mAdditionalTimeFG As Color

    Private mStrongStockMode As Boolean
    Private mIndicateCriticalStock As Boolean
    Private mCriticalColor As Color
    Private mTaskPaneLeft As Boolean
    Private mLargeIcons As Boolean
    Private mSilenceClientDeletion As Boolean
    Private mSilenceClientsDeletion As Boolean
    Private mSilenceAppointmentDeletion As Boolean
    Private mSilenceAppointmentsDeletion As Boolean
    Private mSilenceServiceDeletion As Boolean
    Private mSilenceServicesDeletion As Boolean
    Private mSilenceEmployeeDeletion As Boolean
    Private mSilenceEmployeesDeletion As Boolean
    Private mSilenceProductDeletion As Boolean
    Private mSilenceProductsDeletion As Boolean
    Private mSalonName As String
    Private mUserModeEnabled As Boolean
    Private mDefaultSecurityLevel As SecurityRole
    Private mWarningClientDuplicateNames As Boolean
    Private mOpenCashDrawer As Boolean
    Private mPrintReceipt As Boolean
    Private mAlternativeColorForEmployeeSchedule As Boolean
#End Region

#Region " Properties "

    Public Property EnableAutoLogout() As Boolean
        Get
            Return mEnableAutoLogout
        End Get
        Set(ByVal Value As Boolean)
            If Not mEnableAutoLogout.Equals(Value) Then
                mEnableAutoLogout = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property FitToPage() As Boolean
        Get
            Return mFitToPage
        End Get
        Set(ByVal Value As Boolean)
            If Not mFitToPage.Equals(Value) Then
                mFitToPage = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property



    Public Property AutoLogoutTime() As Integer
        Get
            Return mAutoLogoutTime
        End Get
        Set(ByVal Value As Integer)
            If Not mAutoLogoutTime.Equals(Value) Then
                mAutoLogoutTime = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property DayViewColumnNumber() As Integer
        Get
            Return mDayViewColumnNumber
        End Get
        Set(ByVal Value As Integer)
            If Not mDayViewColumnNumber.Equals(Value) Then
                mDayViewColumnNumber = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property AlternativeColorForEmployeeSchedule() As Boolean
        Get
            Return mAlternativeColorForEmployeeSchedule
        End Get
        Set(ByVal Value As Boolean)
            If Not mAlternativeColorForEmployeeSchedule.Equals(Value) Then
                mAlternativeColorForEmployeeSchedule = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property PrintReceipt() As Boolean
        Get
            Return mPrintReceipt
        End Get
        Set(ByVal Value As Boolean)
            If Not mPrintReceipt.Equals(Value) Then
                mPrintReceipt = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property OpenCashDrawer() As Boolean
        Get
            Return mOpenCashDrawer
        End Get
        Set(ByVal Value As Boolean)
            If Not mOpenCashDrawer.Equals(Value) Then
                mOpenCashDrawer = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property WarningClientDuplicateNames() As Boolean
        Get
            Return mWarningClientDuplicateNames
        End Get
        Set(ByVal Value As Boolean)
            If Not mWarningClientDuplicateNames.Equals(Value) Then
                mWarningClientDuplicateNames = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property BreakForeColor() As Color
        Get
            Return mBreakFG
        End Get
        Set(ByVal Value As Color)
            If Not mBreakFG.Equals(Value) Then
                mBreakFG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property BreakBackColor() As Color
        Get
            Return mBreakBG
        End Get
        Set(ByVal Value As Color)
            If Not mBreakBG.Equals(Value) Then
                mBreakBG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property AdditionalTimeForeColor() As Color
        Get
            Return mAdditionalTimeFG
        End Get
        Set(ByVal Value As Color)
            If Not mAdditionalTimeFG.Equals(Value) Then
                mAdditionalTimeFG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property AdditionalTimeBackColor() As Color
        Get
            Return mAdditionalTimeBG
        End Get
        Set(ByVal Value As Color)
            If Not mAdditionalTimeBG.Equals(Value) Then
                mAdditionalTimeBG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property CalendarResolution() As HoursResolutions
        Get
            Return mResolution
        End Get
        Set(ByVal Value As HoursResolutions)
            If Not mResolution.Equals(Value) Then
                mResolution = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property ScheduleResolution() As HoursResolutions
        Get
            Return mScheduleResolution
        End Get
        Set(ByVal Value As HoursResolutions)
            If Not mScheduleResolution.Equals(Value) Then
                mScheduleResolution = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property DayViewResolution() As HoursResolutions
        Get
            Return mDayViewResolution
        End Get
        Set(ByVal Value As HoursResolutions)
            If Not mDayViewResolution.Equals(Value) Then
                mDayViewResolution = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property FreeHourColor() As Color
        Get
            Return mFreeHourColor
        End Get
        Set(ByVal Value As Color)
            If Not mFreeHourColor.Equals(Value) Then
                mFreeHourColor = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property ExtraFreeHourColor() As Color
        Get
            Return mExtraFreeHourColor
        End Get
        Set(ByVal Value As Color)
            If Not mExtraFreeHourColor.Equals(Value) Then
                mExtraFreeHourColor = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property WorkHourColor() As Color
        Get
            Return mWorkHourColor
        End Get
        Set(ByVal Value As Color)
            If Not mWorkHourColor.Equals(Value) Then
                mWorkHourColor = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property WorkHourColor2() As Color
        Get
            Return mWorkHourColor2
        End Get
        Set(ByVal Value As Color)
            If Not mWorkHourColor2.Equals(Value) Then
                mWorkHourColor2 = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property




    Public Property NewAppointmentBackColor() As Color
        Get
            Return mNewAppBG
        End Get
        Set(ByVal Value As Color)
            If Not mNewAppBG.Equals(Value) Then
                mNewAppBG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SelectedAppointmentBackColor() As Color
        Get
            Return mSelectedAppBG
        End Get
        Set(ByVal Value As Color)
            If Not mSelectedAppBG.Equals(Value) Then
                mSelectedAppBG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property SelectedAppointmentForeColor() As Color
        Get
            Return mSelectedAppFG
        End Get
        Set(ByVal Value As Color)
            If Not mSelectedAppFG.Equals(Value) Then
                mSelectedAppFG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property OpenAppointmentBackColor() As Color
        Get
            Return mOpenAppBG
        End Get
        Set(ByVal Value As Color)
            If Not mOpenAppBG.Equals(Value) Then
                mOpenAppBG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property PaidAppointmentBackColor() As Color
        Get
            Return mPaidAppBG
        End Get
        Set(ByVal Value As Color)
            If Not mPaidAppBG.Equals(Value) Then
                mPaidAppBG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property ScheduleAppointmentBackColor() As Color
        Get
            Return mSchedAppBG
        End Get
        Set(ByVal Value As Color)
            If Not mSchedAppBG.Equals(Value) Then
                mSchedAppBG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property NewAppointmentForeColor() As Color
        Get
            Return mNewAppFG
        End Get
        Set(ByVal Value As Color)
            If Not mNewAppFG.Equals(Value) Then
                mNewAppFG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property OpenAppointmentForeColor() As Color
        Get
            Return mOpenAppFG
        End Get
        Set(ByVal Value As Color)
            If Not mOpenAppFG.Equals(Value) Then
                mOpenAppFG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property PaidAppointmentForeColor() As Color
        Get
            Return mPaidAppFG
        End Get
        Set(ByVal Value As Color)
            If Not mPaidAppFG.Equals(Value) Then
                mPaidAppFG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property ScheduleAppointmentForeColor() As Color
        Get
            Return mSchedAppFG
        End Get
        Set(ByVal Value As Color)
            If Not mSchedAppFG.Equals(Value) Then
                mSchedAppFG = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property




    Public Property StrongStockMode() As Boolean
        Get
            Return mStrongStockMode
        End Get
        Set(ByVal Value As Boolean)
            If mStrongStockMode <> Value Then
                mStrongStockMode = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property IndicateCriticalStock() As Boolean
        Get
            Return mIndicateCriticalStock
        End Get
        Set(ByVal Value As Boolean)
            If mIndicateCriticalStock <> Value Then
                mIndicateCriticalStock = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property CriticalStockColor() As Color
        Get
            Return mCriticalColor
        End Get
        Set(ByVal Value As Color)
            If Not mCriticalColor.Equals(Value) Then
                mCriticalColor = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property TaskPaneLeft() As Boolean
        Get
            Return mTaskPaneLeft
        End Get
        Set(ByVal Value As Boolean)
            If mTaskPaneLeft <> Value Then
                mTaskPaneLeft = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property DefaultSecurityLevel() As SecurityRole
        Get
            Return mDefaultSecurityLevel
        End Get
        Set(ByVal Value As SecurityRole)
            If mDefaultSecurityLevel <> Value Then
                mDefaultSecurityLevel = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property UserModeEnabled() As Boolean
        Get
            Return mUserModeEnabled
        End Get
        Set(ByVal Value As Boolean)
            If mUserModeEnabled <> Value Then
                mUserModeEnabled = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property LargeIcons() As Boolean
        Get
            Return mLargeIcons
        End Get
        Set(ByVal Value As Boolean)
            If mLargeIcons <> Value Then
                mLargeIcons = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SalonName() As String
        Get
            Return mSalonName
        End Get
        Set(ByVal Value As String)
            If mSalonName <> Value Then
                mSalonName = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceAppointmentDeletion() As Boolean
        Get
            Return mSilenceAppointmentDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceAppointmentDeletion <> Value Then
                mSilenceAppointmentDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceAppointmentsDeletion() As Boolean
        Get
            Return mSilenceAppointmentsDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceAppointmentsDeletion <> Value Then
                mSilenceAppointmentsDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceClientDeletion() As Boolean
        Get
            Return mSilenceClientDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceClientDeletion <> Value Then
                mSilenceClientDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceClientsDeletion() As Boolean
        Get
            Return mSilenceClientsDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceClientsDeletion <> Value Then
                mSilenceClientsDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property


    Public Property SilenceServiceDeletion() As Boolean
        Get
            Return mSilenceServiceDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceServiceDeletion <> Value Then
                mSilenceServiceDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceServicesDeletion() As Boolean
        Get
            Return mSilenceServicesDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceServicesDeletion <> Value Then
                mSilenceServicesDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceProductDeletion() As Boolean
        Get
            Return mSilenceProductDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceProductDeletion <> Value Then
                mSilenceProductDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceProductsDeletion() As Boolean
        Get
            Return mSilenceProductsDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceProductsDeletion <> Value Then
                mSilenceProductsDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceEmployeeDeletion() As Boolean
        Get
            Return mSilenceEmployeeDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceEmployeeDeletion <> Value Then
                mSilenceEmployeeDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property

    Public Property SilenceEmployeesDeletion() As Boolean
        Get
            Return mSilenceEmployeesDeletion
        End Get
        Set(ByVal Value As Boolean)
            If mSilenceEmployeesDeletion <> Value Then
                mSilenceEmployeesDeletion = Value
                OnConfigurationChanged()
            End If
        End Set
    End Property
#End Region

#Region " Load Defaults "

    Public Sub LoadDefaults()
        DelayConfig = True
        TaskPaneLeft = False
        LargeIcons = False
        SalonName = "Salon Name"
        UserModeEnabled = False
        DefaultSecurityLevel = SecurityRole.Administrator
        IndicateCriticalStock = True
        StrongStockMode = True
        CriticalStockColor = Color.Red
        WarningClientDuplicateNames = True
        OpenCashDrawer = False
        PrintReceipt = False
        AlternativeColorForEmployeeSchedule = False
        DayViewColumnNumber = 5

        SilenceAppointmentDeletion = False
        SilenceAppointmentsDeletion = False
        SilenceProductDeletion = False
        SilenceProductsDeletion = False
        SilenceServiceDeletion = False
        SilenceServicesDeletion = False
        SilenceClientDeletion = False
        SilenceClientsDeletion = False
        SilenceEmployeeDeletion = False
        SilenceEmployeesDeletion = False

        NewAppointmentBackColor = Color.LightSteelBlue
        NewAppointmentForeColor = Color.Black

        OpenAppointmentBackColor = Color.FromArgb(152, 251, 152)
        OpenAppointmentForeColor = Color.Black

        PaidAppointmentBackColor = Color.FromArgb(215, 177, 0)
        PaidAppointmentForeColor = Color.Black

        ScheduleAppointmentBackColor = Color.FromArgb(70, 40, 240)
        ScheduleAppointmentForeColor = Color.White

        BreakBackColor = Color.Pink
        BreakForeColor = Color.Black

        AdditionalTimeBackColor = Color.LightGreen
        AdditionalTimeForeColor = Color.Black

        SelectedAppointmentBackColor = Color.SandyBrown
        SelectedAppointmentForeColor = Color.White

        WorkHourColor = Color.LemonChiffon
        WorkHourColor2 = Color.LemonChiffon
        FreeHourColor = Color.DarkKhaki
        ExtraFreeHourColor = Color.Khaki

        CalendarResolution = HoursResolutions.TenMinutes
        ScheduleResolution = HoursResolutions.Half
        DayViewResolution = HoursResolutions.TenMinutes

        AutoLogoutTime = 15
        EnableAutoLogout = True

        FitToPage = False

        DelayConfig = False
    End Sub
#End Region

End Class